#include "stdio.h"
#include "stdint.h"
#include "string.h"
#include "stdlib.h"
#include "math.h"
#include "../src/struct_util.h"



int main( int argc, char const *argv[] )
{
    int n;
    char buffer[100] = "";
    int c, len = 0;
    memset( buffer, 0x1a, sizeof( buffer ) );
    if ( argc < 3 )
    {
        printf( "params must be at least 3\n" );
        return -1;
    }

    for ( int i = 2; i < argc; i++ )
    {
        len += strlen( argv[i] );
    }

    n = struct_util_pack( buffer, argv[1],  argv[2],  argv[3],  argv[4],  argv[5],  argv[6],  argv[7], argv[8] );

    for ( c = 0; c < sizeof( buffer ); c++ )
    {
        if ( buffer[c] == 0x1a )
        {
            break;
        }
    }
    if ( c != n )
    {
        printf( " pack:%d B, but byte:buff[%s]changed\n", n, buffer );

        return -1;
    }
    else if ( c != len )
    {
        // printf("%d\n",len);
    }

    {
        printf( "%d:%s\n", n, buffer );
    }



    return 0;
}


